<template>
  <div id="app">
      <keep-alive>
        <router-view v-if="$route.meta.keepAlive == true&&isRouterAlive" ref="appChild"/>
      </keep-alive>
      <router-view v-if="!$route.meta.keepAlive&&isRouterAlive" ref="appChild"/>
  </div>
</template>

<script>
export default{
  name: 'App',
  provide(){
      return{
        reload:this.reload
      }
    },
    data(){
      return{
        isRouterAlive:true,
      }
    },
    mounted(){
      const bodyIns = document.getElementsByTagName('body')[0]
      bodyIns.style.minWidth = `${document.body.clientWidth}px`
    },
    methods:{
      reload(){
        this.isRouterAlive = false;
        this.$nextTick(function(){
          this.isRouterAlive = true;
        })
      },
    },
}
</script>
